<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>旅游问答</title>
    <#--    <link href="/styles/base.css" rel="stylesheet" type="text/css">-->
    <#--    <link href="/styles/public.css" rel="stylesheet" type="text/css">-->
    <#--    <link href="/js/ueditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">-->
    <#--    <link href="/js/datepicker/datepicker.css" rel="stylesheet">-->
    <#--    <link href="/styles/base.css" rel="stylesheet" type="text/css">-->
    <#--    <link href="/styles/addtravelnote.css" rel="stylesheet" type="text/css">-->
    <#--    <script type="text/javascript" src="/js/jquery.js"></script>-->
<#--        <script type="text/javascript" charset="utf-8" src="/js/ueditor/umeditor.config.js"></script>-->
    <#--    <script type="text/javascript" charset="utf-8" src="/js/ueditor/umeditor.min.js"></script>-->
    <#--    <script type="text/javascript" src="/js/ueditor/lang/zh-cn/zh-cn.js"></script>-->
    <#--    <script type="text/javascript" src="/js/system/common.js"></script>-->
    <link href="/styles/base.css" rel="stylesheet" type="text/css">
    <link href="/js/datepicker/datepicker.css" rel="stylesheet">
    <link href="/styles/wendaDetail.css" rel="stylesheet" type="text/css">
    <link href="/styles/base.css" rel="stylesheet" type="text/css">
<#--    <link href="/styles/addtravelnote.css" rel="stylesheet" type="text/css">-->
    <script type="text/javascript" src="/js/jquery/jquery.js"></script>

    <link href="/js/plugins/datepicker/datepicker.css" rel="stylesheet">
    <script src="/js/plugins/datepicker/datepicker.js"></script>
    <script type="text/javascript" src="/js/system/common.js"></script>
    <link href="/styles/addtravelnote.css" rel="stylesheet" type="text/css"
    >
    <script type="text/javascript" charset="utf-8" src="/js/ueditor/umeditor.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/js/ueditor/umeditor.config.js"></script>
    <script type="text/javascript" src="/js/ueditor/lang/zh-cn/zh-cn.js"></script>

    <link href="/js/ueditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
    <script src="/js/plugins/jquery-form/jquery.form.js"></script>
    <link href="/js/plugins/chosen/chosen.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="/js/plugins/chosen/chosen.jquery.js"></script>
    <link href="/js/plugins/chosen/chosen.css" rel="stylesheet" type="text/css">
    <link href="/styles/jquery-labelauty.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="/js/system/public.js"></script>

    <script type="text/javascript" src="/js/system/addquestion.js"></script>

    <script type="text/javascript" src="/js/system/public.js"></script>
    <script type="text/javascript" src="/js/jquery-validate/jquery.validate.min.js"></script>
    <#--    <script src="http://www.softwhy.com/demo/jQuery/js/messages_zh.js"></script>-->
    <#--    <script type="text/javascript" src="/js/checkbox/jquery-labelauty.js"></script>-->
    <#--    <script type="text/javascript" src="/js/checkbox/jquery-1.8.3.min.js"></script>-->

    <script type="text/javascript">
        $(document).ready(function () {
            jQuery(".chosen").chosen();
        });
    </script>
    <script>
        //绑定提交按钮
        $(function () {
            var validate = $("#editForm").validate({
                //验证逻辑
                rules: {
                    title: {
                        required: true,
                        minlength: 10,
                        maxlength: 80
                    }
                },
                //验证失败后提示
                messages: {
                    //可以不写，使用默认的
                    title: {
                        required: "标题名称必填",
                        minlength: "标题补不能小于10个字",
                        maxlength: "标题必须小于80个字"
                    },
                },
                submitHandler: function (form) {
                    var content = ue.getContent();
                    if (!content) {
                        popup("内容不能为空");
                        return;
                    }
                    $('#content').val(content);
                    $(form).ajaxSubmit(function (data) {
                        if (data.success) {
                            window.location.href = '/wenda/';
                        } else {
                            popup(data.msg);
                        }
                    })
                }
            })

            $(".btnSubmit").click(function () {
                $("#editForm").submit();
            })

        })
    </script>
    <style>
        input.error {
            border: 1px solid red;
        }

        label.error {
            font-weight: bold;
            color: red;
        }


        /*/*/
        /*/*/
        /*对号样式*/
        .icon-span {
            display: inline-block;
            background-color: #fff;
            border-radius: 4px;
            border: 2px solid #7f7f7f;
            position: relative;
            width: 18px;
            height: 18px;
            vertical-align: middle;
        }

        .icon-span::after {
            border: 2px solid transparent;
            border-left: 0;
            border-top: 0;
            content: " ";
            top: 2px;
            left: 5px;
            position: absolute;
            width: 4px;
            height: 8px;
            -webkit-transform: rotate(45deg) scale(0);
            transform: rotate(45deg) scale(0);
            -webkit-transition: -webkit-transform .2s;
            transition: -webkit-transform .2s;
            transition: transform .2s;
            transition: transform .2s, -webkit-transform .2s;
        }

        .icon-span-select {
        }

        .icon-span-select::after {
            border-color: #fff;
            -webkit-transform: rotate(45deg) scale(1);
            transform: rotate(45deg) scale(1);
        }
    </style>
</head>

<body>
<#assign currentNav="wenda">
<#include "../common/navbar.ftl">
<div class="wrapper">
    <div class="qt-container clearfix">
        <div class="qt-main">
            <div class="crumb">
                <a href="/wenda/">旅游问答</a> &gt; <span>我要提问</span>
            </div>

            <form action="/wenda/saveOrUpdate" method="post" id="editForm">
                <div class="qt-tit">
                    <h3>问题标题</h3>
                    <div class="qt-con">
                        <input type="text" placeholder="标题不小于10字哦" class="_j_title" name="title">
                        <input type="hidden" id="content" name="questionContent.content">
                        <#--                        <input type="hidden" name="questionId">-->
                        <span class="count"><span class="_j_title_num">0</span>/80 字</span>
                        <span class="_j_min_num hide">10</span>
                        <span class="error err-tips _j_title_error">标题不能少于10字</span>
                    </div>
                </div>
                <br>
                <h3>请选择目的地</h3>
                <select class='chosen w-country' data-placeholder='请选择国家' name="dest.id">
                    <option value="1" selected>中国</option>
                    <#list dests as d>
                        <#if d.id != 1>
                            <option value="${d.id}">${d.name!}</option>
                        </#if>
                    </#list>
                </select>
                <br>
                <br>
                <h3>选择兴趣标签</h3>
                <#list tags as tag>
                    <input type="checkbox" name="tags" value="${tag.id}">${tag.name!}
                </#list>
                <#--                <input class="radio_type" type="radio" name="tags" i value="1"/>-->
                <#--                <label for="radio1">自驾</label>-->
                <#--                <input class="radio_type" type="radio" name="tags" value="2"/>-->
                <#--                <label for="radio2">亲子</label>-->
                <#--                <input class="radio_type" type="radio" name="tags" value="3"/>-->
                <#--                <label for="radio3">摄影</label>-->
                <#--                <input class="radio_type" type="radio" name="tags" value="4" checked/>-->
                <#--                <label for="radio3">美食</label>-->

                <#--                <input class="radio_type" type="radio" name="tags" value="5"/>-->
                <#--                <label for="radio4">滑雪</label>-->

                <#--                <input class="radio_type" type="radio" name="tags" value="6"/>-->
                <#--                <label for="radio4">购物</label>-->

                <#--                <input class="radio_type" type="radio" name="tags" value="7"/>-->
                <#--                <label for="radio5">徒步</label>-->

                <#--                <input class="radio_type" type="radio" name="tag" value="8"/>-->
                <#--                <label for="radio6">潜水</label>-->
            </form>
            <div class="qt-details">
                <h5><a title="添加问答内容" class="icon active" id="_j_show_content"></a>问题详细内容</h5>
                <dd id="content_div">
                    <script id="editor" type="text/plain" style="width:100%;height:500px;"></script>
                </dd>
            </div>
            <div class="publish_question">
                <button class="btnSubmit" title="发布问题" type="button">发布问题</button>
            </div>
            <div class="qt-sider">
                <div class="qts-tit">提问的正确姿势</div>
                <div class="qts-con">
                    <p>1.问题要【具体】【真实】【诚恳】，问题较多，需全面阐述时，可以添加问题补充。结伴/交易/与旅行无关的提问将被删除。</p>
                    <p>2.给问题添加目的地，并打上正确的标签将有助于更快地获得回答。</p>
                </div>
            </div>
        </div>
    </div>
</body>

</html>